/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package modele;

import java.util.Collection;
import java.util.HashSet;
import java.util.TreeSet;

/**
 *
 * @author mbamba
 */
public class Dep implements Comparable<Dep> {

    private String num;
    private Collection<Med> lesMeds = new TreeSet<Med>();

    public Dep(String num) {
        this.num = num;
        
    }

    public String getNum() {
        return num;
    }

    public Collection<Med> getLesMeds() {
        return lesMeds;
    }

    public int compareTo(Dep t) {
        return num.compareTo(t.num);

    }

    public Collection<Med> getLesMedes(String nom) {

        Collection<Med> lesMedsParLettre = new HashSet<Med>();

        for (Med unMed : lesMeds) {
            if (unMed.getNom().startsWith(nom)) {
                lesMedsParLettre.add(unMed);
            }
        }

        return lesMedsParLettre;
    }
    
      void addUnMed(Med unMed) {
        lesMeds.add(unMed);
    }
}